import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * 点击消除
 * User: xwl
 * Date: 2023-06-06
 * Time: 21:30
 */

public class Test2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            String str = in.nextLine();
            Deque<Character> stack = new ArrayDeque<>();
            List<Character> list = new ArrayList<>();
            for (int i = 0; i < str.length(); i++) {
                char ch = str.charAt(i);
                if (stack.isEmpty() || ch != stack.peek()) {
                    stack.push(ch);
                } else {
                    stack.pop();
                }
            }
            //
            if (stack.isEmpty()) {
                System.out.println('0');
            } else {
                while (!stack.isEmpty()) {
                    list.add(stack.pop());
                }
                Collections.reverse(list);
                for (int i = 0; i < list.size(); i++) {
                    System.out.print(list.get(i));
                }
            }
        }
    }

    public static void main2(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            String str = in.nextLine();
            StringBuilder stringBuilder = new StringBuilder(str.length());
            int index = -1;
            for (int i = 0; i < str.length(); i++) {
                char ch = str.charAt(i);
                if (index == -1 || ch != stringBuilder.charAt(index)) {
                    stringBuilder.append(ch);
                    index++;
                } else {
                    stringBuilder.deleteCharAt(index);
                    index--;
                }
            }
            if (index == -1) {
                System.out.println(0);
            } else {
                System.out.println(stringBuilder);
            }
        }
    }
}
